﻿Imports System
Imports System.IO
Imports System.Runtime.Serialization
Imports System.Runtime.Serialization.Formatters.Binary
''' <summary>
''' 污染物名称和对应的背景浓度
''' </summary>
''' <remarks></remarks>
<Serializable()> Public Class PollutBackCon
    Implements ICloneable


    ''' <summary>
    ''' 污染物的名称
    ''' </summary>
    ''' <remarks></remarks>
    Private m_Name As String

    ''' <summary>
    ''' 对应1  2  3  4  6  8  12  24  month period的背景浓度
    ''' </summary>
    ''' <remarks></remarks>
    Private m_ArrayAverageTimeBackCon(9) As AverageTimeBackCon

    ''' <summary>
    ''' 污染物的名称
    ''' </summary>
    ''' <remarks></remarks>
    Property Name() As String
        Get
            Return Me.m_Name
        End Get
        Set(ByVal value As String)
            Me.m_Name = value
        End Set
    End Property
    Public Sub New()
        For i As Integer = 0 To m_ArrayAverageTimeBackCon.Length - 1
            m_ArrayAverageTimeBackCon(i) = New AverageTimeBackCon
        Next
    End Sub
    ''' <summary>
    ''' 对应1  2  3  4  6  8  12  24  month period的背景浓度
    ''' </summary>
    ''' <remarks></remarks>
    Property ArrayAverageTimeBackCon() As AverageTimeBackCon()
        Get
            Return Me.m_ArrayAverageTimeBackCon
        End Get
        Set(ByVal value As AverageTimeBackCon())
            Me.m_ArrayAverageTimeBackCon = value
        End Set
    End Property
    ''' <summary>
    ''' 根据不同的平均时间返回对应的背景浓度
    ''' </summary>
    ''' <param name="AverageTime"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function GetBackCon(ByVal AverageTime As String) As AverageTimeBackCon
        Select Case AverageTime
            Case "1h"
                Return m_ArrayAverageTimeBackCon(0)
            Case "2h"
                Return m_ArrayAverageTimeBackCon(1)
            Case "3h"
                Return m_ArrayAverageTimeBackCon(2)
            Case "4h"
                Return m_ArrayAverageTimeBackCon(3)
            Case "6h"
                Return m_ArrayAverageTimeBackCon(4)
            Case "8h"
                Return m_ArrayAverageTimeBackCon(5)
            Case "12h"
                Return m_ArrayAverageTimeBackCon(6)
            Case "24h"
                Return m_ArrayAverageTimeBackCon(7)
            Case "月平均"
                Return m_ArrayAverageTimeBackCon(8)
            Case "期间平均"
                Return m_ArrayAverageTimeBackCon(9)
        End Select
        Return Nothing
    End Function

    Public Function Clone() As Object Implements System.ICloneable.Clone
        Dim obj As New PollutBackCon
        obj.m_Name = Me.m_Name
        ReDim obj.m_ArrayAverageTimeBackCon(Me.m_ArrayAverageTimeBackCon.Length - 1)
        For i As Integer = 0 To Me.m_ArrayAverageTimeBackCon.Length - 1
            obj.m_ArrayAverageTimeBackCon(i) = Me.m_ArrayAverageTimeBackCon(i).Clone
        Next
        Return obj
    End Function
End Class
